<template>
  <el-dialog v-model="isVisible" title="新增">
    <el-form label-width="100px">
      <el-form-item label="数据来源">
        <el-radio-group v-model="dataResource">
          <el-radio value="Sponsor">数据集</el-radio>
          <el-radio value="Venue">数据源</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="选择数据">
        <el-select
          v-model="templateName"
          :options="options"
          placeholder="请选择"
        >
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
      </el-form-item>
    </el-form>
    <template #footer>
      <el-button @click="closeModal">取消</el-button>
      <el-button type="primary" @click="confirmSaveAs">确认</el-button>
    </template>
  </el-dialog>
</template>

<script setup lang="ts">
import { ref } from "vue";
const options = ref([{ value: "1", label: "11" }]);
const isVisible = ref(false);
const templateName = ref("");
const dataResource = ref("");

const open = () => {
  isVisible.value = true;
};

const closeModal = () => {
  isVisible.value = false;
};

const confirmSaveAs = () => {
  console.log("确认另存为操作，模版名称:", templateName.value);
  closeModal();
};

defineExpose({
  open,
});
</script>
